package com.example.demobean;

import com.example.demobean.bean.BeanTest;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * 示例参考了：
 * Spring | Autowire | Dependency Injection | Spring Boot
 * https://youtu.be/K43qyHJXmWI
 */
@SpringBootApplication
public class DemobeanApplication {

    public static void main(String[] args) {

        ConfigurableApplicationContext configurableApplicationContext =
                SpringApplication.run(DemobeanApplication.class, args);

        Student student = configurableApplicationContext.getBean(Student.class);
        student.show();
//Student 加了@Scope(value="prototype")之后就会创建两个对象
//        Student student1 = configurableApplicationContext.getBean(Student.class);
//        student1.show();

        Object object = configurableApplicationContext.getBean("my-bean-test");

    }

}
